Repository navigation
refactor(controllers): adopt with_session in web saved_message - #41859
Merged
asukaminato0721 merged 2 commits intoSep 7, 2026
Merged
asukaminato0721 merged 2 commits into
asukaminato0721 merged 2 commits into
Conversation
Replace the three inline db.session() calls with the existing with_session decorator so each handler owns one session with an explicit commit/rollback boundary.
asukaminato0721
approved these changes
Sep 7, 2026
asukaminato0721
enabled auto-merge
September 7, 2026 05:20
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-09-07 05:30:32.838099153 +0000
+++ /tmp/pyrefly_pr.txt 2026-09-07 05:30:24.382057037 +0000
@@ -3333,19 +3333,19 @@
ERROR Argument `Iterator[Any]` is not assignable to parameter `response` with type `Generator[str] | RateLimitGenerator` in function `controllers.console.app.completion._drain_streaming_generate_response` [bad-argument-type]
--> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1800:66
ERROR Object of class `object` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2222:50
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2212:50
ERROR Object of class `object` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2223:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2213:30
ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2224:33
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2214:33
ERROR Object of class `object` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2267:50
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2251:50
ERROR Object of class `object` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2268:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2252:30
ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2269:33
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2253:33
ERROR Argument `Literal['00000000-0000-0000-0000-000000000002']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2371:24
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:2350:24
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
--> tests/unit_tests/controllers/console/app/test_annotation_security.py:237:38
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
@@ -3375,13 +3375,13 @@
ERROR Cannot index into `object` [bad-index]
--> tests/unit_tests/controllers/console/app/test_audio.py:158:17
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_message_api.py:128:26
+ --> tests/unit_tests/controllers/console/app/test_message_api.py:115:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_message_api.py:129:23
+ --> tests/unit_tests/controllers/console/app/test_message_api.py:116:23
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._get_message_detail` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_message_api.py:151:19
+ --> tests/unit_tests/controllers/console/app/test_message_api.py:138:19
ERROR Argument `Literal['550e8400-e29b-41d4-a716-446655440000']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_detail` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_message_api.py:152:20
+ --> tests/unit_tests/controllers/console/app/test_message_api.py:139:20
ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
--> tests/unit_tests/controllers/console/app/test_model_config_api.py:89:51
ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
@@ -3584,8 +3584,6 @@
--> tests/unit_tests/controllers/inner_api/plugin/test_plugin_wraps.py:388:35
ERROR Missing argument `payload` in function `protected_view` [missing-argument]
--> tests/unit_tests/controllers/inner_api/plugin/test_plugin_wraps.py:394:36
-ERROR Object of class `Resource` has no attribute `post` [missing-attribute]
- --> tests/unit_tests/controllers/inner_api/workspace/test_workspace.py:364:17
ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
--> tests/unit_tests/controllers/mcp/test_mcp.py:38:13
ERROR `SimpleNamespace` is not assignable to attribute `mcp_ns` with type `Namespace` [bad-assignment]
|
Contributor
Pyrefly Type Coverage
|
This was referenced Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #37403
Replaces the three inline
db.session()calls inapi/controllers/web/saved_message.pywith the existing@with_sessiondecorator, so each handler owns one session with an explicit commit/rollback boundary instead of reaching for the scoped session at every call site.SavedMessageServicealready accepts an explicitsession, so this is the controller-side follow-up.SavedMessageListApi.getuses@with_session(write=False)(read-only)SavedMessageListApi.postandSavedMessageApi.deleteuse@with_sessionextensions.ext_databaseimportapi/controllers/web/message.pyVerified:
check_no_new_controller_sqlalchemy.pyclean,lint-imports26/26 kept, ruff check + format clean, pyrefly clean,pytest tests/unit_tests/controllers3960 passed.